package com.gf.gf_data.util;

import org.apache.commons.lang3.StringUtils;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by lyx on 2017/9/5.
 */
public class RequestUtils {

    public static int HTTP_STATUS_SESSION_EXPIRE = 401;

    /**
     * 判断是否为Ajax请求
     * @param request
     * @return
     */
    public static boolean isAjax(HttpServletRequest request) {
        String header = request.getHeader("X-Requested-With");
        if (StringUtils.isNotBlank(header) && (header.equals("X-Requested-With") || header.equals("XMLHttpRequest")))
           return true;
         return false;
    }
}

